const obj = {
  items: ['1', '2', '3', '4', '5'],

  // 自定义迭代器
  [Symbol.iterator]() {
    let index = 0;
    const items = this.items;
    return {
      next() {
        return {
          value: items[index++],
          done: index > items.length,
        };
      },
    };
  },

  // 自定义toString
  [Symbol.toStringTag]: 'My is Obj',
};

for (const item of obj) {
  console.log(item);
}

console.log(Object.prototype.toString.call(obj));
